package com.woniuxy.mapper;

import com.woniuxy.entity.CommunicateContext;
import com.woniuxy.entity.CommunicateContextExample;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;


/*
@author Jan
@create 2020-05-20 19:00

*/

public interface CommunicateContextMapper {
    long countByExample(CommunicateContextExample example);

    int deleteByExample(CommunicateContextExample example);

    int deleteByPrimaryKey(Integer contextId);

    int insert(CommunicateContext record);

    int insertSelective(CommunicateContext record);

    List<CommunicateContext> selectByExample(CommunicateContextExample example);

    CommunicateContext selectByPrimaryKey(Integer contextId);

    int updateByExampleSelective(@Param("record") CommunicateContext record, @Param("example") CommunicateContextExample example);

    int updateByExample(@Param("record") CommunicateContext record, @Param("example") CommunicateContextExample example);

    int updateByPrimaryKeySelective(CommunicateContext record);

    int updateByPrimaryKey(CommunicateContext record);

    @Select("select " +
            "context_id id,username,comment_text content " +
            "from communicate_context ct left join user u on u.user_id = ct.user_id where ct.comment_id = #{id} ORDER BY time")
    List<Map<String,Object>> selectAllByCommentId(Integer id);
}